<?php
/**
 * DBShop 电子商务系统
 *
 * ==========================================================================
 * @link      https://www.dbshop.net/
 * @copyright 北京珑大钜商科技有限公司，并保留所有权利。
 * @license   https://www.dbshop.net/license.html License
 * ==========================================================================
 *
 * @author    静静的风 <baron@loongdom.cn>
 *
 */

namespace Admin\Repository;

use Admin\Entity\SelfLocation;
use Admin\Entity\SelfLocationMember;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;

class SelfLocationMemberRepository extends EntityRepository
{
    /**
     * 核销员列表
     * @param array $search
     * @return int|mixed|string
     */
    public function findMemberList($search = [])
    {
        $query = $this->getEntityManager()->createQueryBuilder();
        $query->select('m', 'l.locationName')
            ->from(SelfLocationMember::class, 'm')
            ->leftJoin(SelfLocation::class, 'l', Join::WITH, 'm.locationId = l.locationId')
            ->orderBy('m.memberId', 'DESC');

        return $query->getQuery()->getResult();
    }
}